-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regen byron #194
Regen byron #194
Conversation
using specs/byron_minimal.cddl byron/utils.rs had to be modified a fair bit to deal with changes in cddl-codegen since then, .cbor bytes support, etc.
to see which changes were made from the old code, ignore the first commit in the diff tab. the first commit is just copying over the old byron code directly. |
} | ||
|
||
impl_hash_type!(AddressId, 28); | ||
// not sure if this is a hash but it likely is and has the same byte format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK it was meant to be a hash and then this feature was never added to mainnet in the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright I'll just leave it then. whatever it was meant to be, the hash type doesn't have any explicitly "hash" things I guess. it's just a fixed size byte buffer that can be converted to hex/etc.
AddressContent::hash_and_create(addr_type, &spending_data, attributes) | ||
} | ||
|
||
/// Do we want to remove this or keep it for people who were using old Byron code? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with either. If we don't need it, it's not hard to replace imo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After having run into some type annotations needed in a few places when trying to use the From/Into for addresses, I think we could just keep the to_address()/from_address() things everywhere since it'd also be consistent with wasm (where we can't expose traits) and would help people migrating from CSL/old CML.
|
||
; Addresses | ||
|
||
; cddl had bootstrap as (1, uint) but byron/mod.rs had no uint field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't remember off the top of my head the history to this, but I can look into it to try and remember
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may have just been a mistake on my part. The original cddl is addrdistr = [1] / [0, stakeholderid]
and I think maybe I added a uint
for the [1]
case even though it shouldn't have been there
tag: 0, stakeholder_id // | ||
; @name BootstrapEra | ||
bootstrap_era: 1 | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to put the field name as bootstrap_era
too since cddl-codegen's dcSpark/cddl-codegen#153 ignores @name
for single-field group choices. i.e. tag: 1
as the field would make the entire variant come out as StakeDistribution::Tag
instead of just the fixed field during serialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
using specs/byron_minimal.cddl
byron/utils.rs had to be modified a fair bit to deal with changes in
cddl-codegen since then, .cbor bytes support, etc.